using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using KuiHuaBaoDian.SDK.Serializable;

namespace KuiHuaBaoDian.SDK {

    public partial interface IAPI {

        public delegate void NotifyDelegate();
        public delegate void SystemInfoDelegate(ISystemInfo systemInfo);

        event SystemInfoDelegate ApplicationShow;
        event NotifyDelegate ApplicationHide;

        bool IsEnabled { get; }

        UniTask<ISystemInfo> GetSystemInfo(string inviterKey = null);

        UniTask<ILoginResult> Login();

        #region Share
        UniTask InitializeShare(Func<string> getQueryFunc = null, IEnumerable<ShareImageSetting> settings = null);

        UniTask<bool> Share();
        #endregion

        #region RewardedAD
        UniTask InitializeRewardedAD(RewardedADSetting setting);

        UniTask<IRewardedADResult> ShowRewardedAD(Action<IRewardedADResult> onLoad = null);
        #endregion
    }

    public static partial class API {

        private static IAPI m_Instance;
        public static IAPI Instance => m_Instance ??= CreateInstance();
        private static partial IAPI CreateInstance();

    }
}
